﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Data;
using TidyBlog.Data.Mapping;

namespace TidyBlog.Entity
{
    /// <summary>
    /// 评论实体类
    /// </summary>
    [Table(Name = "TidyBlog_Comment", IsIgnoreRead = true, IsIgnoreUpdate = true)]
    public class Comment
    {
        /// <summary>
        /// 评论编号
        /// </summary>
        [Column(Name = "CommentId", IsPrimaryKey = true, IsDbGenerated = true)]
        public int CommentId { get; set; }
        /// <summary>
        /// 作者编号（访客编号为0）
        /// </summary>
        [Column]
        public int AuthorId { get; set; }
        /// <summary>
        /// 作者名
        /// </summary>
        [Column(DataType = DbType.String, Length = 20), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string AuthorName { get; set; }
        /// <summary>
        /// Email
        /// </summary>
        [Column(DataType = DbType.String, Length = 80), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Email { get; set; }
        /// <summary>
        /// 个人主页
        /// </summary>
        [Column(DataType = DbType.String, Length = 80), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string HomePage { get; set; }
        /// <summary>
        /// 内容
        /// </summary>
        [Column(DataType = DbType.String), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string Content { get; set; }
        /// <summary>
        /// 可见性（0-审核，1-可见）
        /// </summary>
        [Column]
        public byte Visibility { get; set; }
        /// <summary>
        /// 作者IP
        /// </summary>
        [Column(DataType = DbType.AnsiString, Length = 15), DisplayFormat(ConvertEmptyStringToNull = false)]
        public string IP { get; set; }
        /// <summary>
        /// 发表时间
        /// </summary>
        [Column]
        public DateTime PostTime { get; set; }
        /// <summary>
        /// 所属文章编号
        /// </summary>
        [Column]
        public int ArticleId { get; set; }
    }
}